<?php
$con = mysql_connect("localhost" , "root" , "alaamagwa");
$username = $_POST['uname'];
$pass = $_POST['password'];
$salt= substr($username , 0 , 2);
$enc_pass = crypt($password ,$salt);
if(!$con){
    die("Database connection failed : " . mysql_error());
}
$db = mysql_select_db("draftsstore",$con);
if (!$db){
    die("Database connection failed : " . mysql_error());
}
$result = mysql_query("SELECT * FROM users WHERE username = '{$_POST['uname']}' AND password = '$enc_pass'  ", $con);
while($users= mysql_fetch_array($result)){ 
echo "Access Granted";
}


?>





